﻿using NPOI.SS.UserModel;

namespace Soul.XLS
{
    public class ExcelCellStyle : ICellStyle
    {
        internal ICellStyle Style { get; }

        public IFont Font { get; }

        public int RowHeight { get; set; }

        public int ColumnWidth { get; set; } = 8;

        public string Format { get; set; }

        public ExcelCellStyle(IFont font, ICellStyle style)
        {
            Font = font;
            Style = style;
        }

        public bool ShrinkToFit { get => Style.ShrinkToFit; set => Style.ShrinkToFit = value; }
        public short Index => Style.Index;
        public short DataFormat { get => Style.DataFormat; set => Style.DataFormat = value; }
        public short FontIndex => Style.FontIndex;
        public bool IsHidden { get => Style.IsHidden; set => Style.IsHidden = value; }
        public bool IsLocked { get => Style.IsLocked; set => Style.IsLocked = value; }
        public HorizontalAlignment Alignment { get => Style.Alignment; set => Style.Alignment = value; }
        public bool WrapText { get => Style.WrapText; set => Style.WrapText = value; }
        public VerticalAlignment VerticalAlignment { get => Style.VerticalAlignment; set => Style.VerticalAlignment = value; }
        public short Rotation { get => Style.Rotation; set => Style.Rotation = value; }
        public short Indention { get => Style.Indention; set => Style.Indention = value; }
        public BorderStyle BorderLeft { get => Style.BorderLeft; set => Style.BorderLeft = value; }
        public BorderStyle BorderRight { get => Style.BorderRight; set => Style.BorderRight = value; }
        public BorderStyle BorderTop { get => Style.BorderTop; set => Style.BorderTop = value; }
        public BorderStyle BorderBottom { get => Style.BorderBottom; set => Style.BorderBottom = value; }
        public short LeftBorderColor { get => Style.LeftBorderColor; set => Style.LeftBorderColor = value; }
        public short RightBorderColor { get => Style.RightBorderColor; set => Style.RightBorderColor = value; }
        public short TopBorderColor { get => Style.TopBorderColor; set => Style.TopBorderColor = value; }
        public short BottomBorderColor { get => Style.BottomBorderColor; set => Style.BottomBorderColor = value; }
        public FillPattern FillPattern { get => Style.FillPattern; set => Style.FillPattern = value; }
        public short FillBackgroundColor { get => Style.FillBackgroundColor; set => Style.FillBackgroundColor = value; }
        public short FillForegroundColor { get => Style.FillForegroundColor; set => Style.FillForegroundColor = value; }
        public short BorderDiagonalColor { get => Style.BorderDiagonalColor; set => Style.BorderDiagonalColor = value; }
        public BorderStyle BorderDiagonalLineStyle { get => Style.BorderDiagonalLineStyle; set => Style.BorderDiagonalLineStyle = value; }
        public BorderDiagonal BorderDiagonal { get => Style.BorderDiagonal; set => Style.BorderDiagonal = value; }
        public IColor FillBackgroundColorColor => Style.FillBackgroundColorColor;
        public IColor FillForegroundColorColor => Style.FillForegroundColorColor;

        public bool IsQuotePrefixed { get => Style.IsQuotePrefixed; set => Style.IsQuotePrefixed = value; }

        public string GetDataFormatString()
        {
            return Style.GetDataFormatString();
        }

        public void SetFont(IFont font)
        {
            Style.SetFont(font);
        }

        public void CloneStyleFrom(ICellStyle source)
        {
            Style.CloneStyleFrom(source);
        }

        public IFont GetFont(IWorkbook parentWorkbook)
        {
            return Style.GetFont(parentWorkbook);
        }
    }
}
